#ifndef VIEWWINDOW_H
#define VIEWWINDOW_H

#include <QMainWindow>
#include <QCloseEvent>
#include <QComboBox>
#include "Qt/multithread.h"
#include "Qt/socketthread.h"
#include "agreement/obd_shanghai.h"

namespace Ui {
class ViewWindow;
}

class ViewWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit ViewWindow(QWidget *parent = nullptr);
    ~ViewWindow();

    void closeEvent(QCloseEvent *event);

//signals:
//    void sigClose(const QString obj);

private slots:
    void on_pushButton_Connect_clicked();

    void on_pushButton_Clear_clicked();

    void on_checkBox_VIN_clicked();

    void on_checkBox_SN_clicked();

public slots:
    void handleResults(const QString result, const void* data);

private:
    int handle_request_login(const struct general_pack_shanghai* const _pack);
    int handle_request_logout(const struct general_pack_shanghai* const _pack);
    int handle_request_userdef(int const viewer, const struct general_pack_shanghai* const _pack);
    int handle_report_real(const struct general_pack_shanghai *const _pack);

    int ViewPrint(const char *__format, ...);
    void update_vin(const char* const vin);
    void update_sn(const char* const sn);
    void update_List(QComboBox *comboBox_List, const char* const item, const int item_size);

private:
    Ui::ViewWindow *ui;
    SocketThread *viewer;
    ControllerMultiThread *_controller;
    uint32_t handle_count;
    char log_path[128];
    int pshow;
};

#endif // VIEWWINDOW_H
